package com.pos.clothes.service.serviceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pos.clothes.mapper.ColorMapper;
import com.pos.clothes.pojo.Category;
import com.pos.clothes.pojo.Color;
import com.pos.clothes.pojo.Size;
import com.pos.clothes.service.ColorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
public class ColorServiceImpl implements ColorService {
    @Autowired
    private ColorMapper mapper;

//    @Override
//    @Transactional(rollbackFor = { RuntimeException.class, Exception.class })
//    public PageInfo getColor(int pageNum, int pageSize) throws Exception {
//        //使用分页插件,核心代码就这一行
//        PageHelper.startPage(pageNum, pageSize);
//        /* 获取 */
//        List<Color> typeList = mapper.getColor();
//        PageInfo pageInfo  = new PageInfo(typeList);
//        return pageInfo;
//    }
    @Override
    public List<Color> getColor() {
        return mapper.getColor();
    }

    @Override
    public void insertColor(Color color) {
        mapper.insertColor(color);
    }

    @Override
    public int deleteColor(int idcolor) {
        return mapper.deleteColor(idcolor);
    }

    @Override
    public void updateColor(Color color) {
        mapper.updateColor(color);
    }

    @Override
    public List<Color> searchColor(String color) {
        return mapper.searchColor(color);
    }
}
